package com.atguigu.gmall.realtime.util;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateFormatUtil {
    
    private static final DateTimeFormatter parDateFormat = DateTimeFormatter.ofPattern("yyyyMMdd");
    public static String toPartitionDate(long ts) {
        Date dt = new Date(ts);
        LocalDateTime localDateTime = LocalDateTime.ofInstant(dt.toInstant(), ZoneId.systemDefault());
        return parDateFormat.format(localDateTime);
    }
    
}